package com.cbw.bean;

import java.sql.Timestamp;
import java.util.Objects;

public class User {
    private int id; //主键
    private String number;//编号
    private String username;//昵称(姓名)
    private String userPhone;//手机
    private String password;//密码
    private Timestamp createTime;//注册时间
    private Timestamp lastTime;//上次登录时间
    private String cardId;//身份证号
    private boolean isUser;// 验证身份 true是用户,false是快递员，后台管理系统中用户管理用不到该字段，主要是微信端登录时判断是用户还是快递员(通过手机号去快递员表查询不到则就是用户)


    public boolean isUser() {
        return isUser;
    }

    public void setUser(boolean user) {
        isUser = user;
    }

    public User() {

    }

    public User(int id, String number, String username, String userPhone, String password, Timestamp createTime, Timestamp lastTime, String cardId,boolean isUser) {
        this.id = id;
        this.number = number;
        this.username = username;
        this.userPhone = userPhone;
        this.password = password;
        this.createTime = createTime;
        this.lastTime = lastTime;
        this.cardId = cardId;
        this.isUser=isUser;
    }


    public User(String number, String username, String password, String userPhone, String cardId) {
        this.number = number;
        this.username = username;
        this.userPhone = userPhone;
        this.password = password;
        this.cardId = cardId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return id == user.id && Objects.equals(number, user.number) && Objects.equals(username, user.username) && Objects.equals(userPhone, user.userPhone) && Objects.equals(password, user.password) && Objects.equals(createTime, user.createTime) && Objects.equals(lastTime, user.lastTime) && Objects.equals(cardId, user.cardId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, number, username, userPhone, password, createTime, lastTime, cardId);
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", number='" + number + '\'' +
                ", username='" + username + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", password='" + password + '\'' +
                ", createTime=" + createTime +
                ", lastTime=" + lastTime +
                ", cardId='" + cardId + '\'' +
                '}';
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Timestamp  getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getLastTime() {
        return lastTime;
    }

    public void setLastTime(Timestamp lastTime) {
        this.lastTime = lastTime;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }
}
